package cn.itsource.org.controller;

import cn.itsource.basic.util.AjaxResult;
import cn.itsource.org.domain.Employee;
import cn.itsource.org.domain.User;
import cn.itsource.org.service.IEmployeeService;
import cn.itsource.org.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户控制器
 */
@RestController
@RequestMapping("/system")
@Api(tags = "登录", description = "登录操作接口")
public class LoginController {

    @Autowired
    private IEmployeeService employeeService;

    @Autowired
    private IUserService userService;

    /**
     * 注册
     */
    @PostMapping("/login")
    @ApiOperation(value = "登录")
    public AjaxResult registerUser(@RequestBody Employee employee) {

        //调用登录业务
        return employeeService.login(employee);

    }

    /**
     * 注册
     */
    @PatchMapping("/login")
    @ApiOperation(value = "登录")
    public AjaxResult registerUser(@RequestBody User user) {

        //调用登录业务
        return userService.login(user);

    }



}
